#pragma once

#include "Logger.hpp"

/// Provide cross platform function to handle dll, so and dylib file.

// Cross platform import/export macro for shared lib
#ifdef _WIN32 // Windows

#define EXPORTF __declspec(dllexport)
#define IMPORTF __declspec(dllimport)

#ifdef _MSC_VER

#pragma warning(disable: 4251)

#endif

#else // Linux, FreeBSD, Mac OS X

#if __GNUC__ >= 4

#define EXPORTF __attribute__ ((__visibility__ ("default")))
#define IMPORTF __attribute__ ((__visibility__ ("default")))

#else

#define EXPORTF
#define IMPORTF

#endif

#endif

// Window
#if _WIN32
#include <windows.h>
// Unix like
#else
#include <dlfcn.h>
#endif

void* loadLib(const char* file);
void* loadFunc(void* handle, const char* name);
bool freeLib(void* handle);
